package com.iflytek.top1;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class CovidTop1Reducer extends Reducer<CovidBean, NullWritable,CovidBean,NullWritable> {
    @Override
    protected void reduce(CovidBean key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        //不遍历迭代器，此时key就是分组中的第一个key 也就是该州确诊病例数最多的县对应的数据
        context.write(key,NullWritable.get());
       /* int num = 0;
        for ( NullWritable value : values) {
            //输出每个州最多的前3个
            if(num <1){
                context.write(key,value);
                num++;
            }else {
                return;
            }
        } */
    }
}